<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>ftell</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_005_338">&nbsp;</a>NAME</h4><blockquote>
ftell, ftello - return a file offset in a stream
</blockquote><h4><a name = "tag_000_005_339">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="stdio.h.html">stdio.h</a>&gt;

long int ftell(FILE *<i>stream</i>);
off_t ftello(FILE *<i>stream</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_005_340">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>ftell()</i>
function obtains the current value of the file-position indicator
for the stream pointed to by
<i>stream</i>.
<p>
The
<i>ftello()</i>
function is identical to
<i>ftell()</i>
except that the return value is of type
<b>off_t</b>.
</blockquote><h4><a name = "tag_000_005_341">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion,
<i>ftell()</i>
and
<i>ftello()</i>
return the current value of the file-position indicator
for the stream measured in bytes from the beginning of the file.
<p>
Otherwise,
<i>ftell()</i>
and
<i>ftello()</i>
return -1, cast to
<b>long</b>
and
<b>off_t</b>
respectively, and set
<i>errno</i>
to indicate the error.
</blockquote><h4><a name = "tag_000_005_342">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>ftell()</i>
and
<i>ftello()</i>
functions will fail if:
<dl compact>

<dt>[EBADF]<dd>
The file descriptor underlying
<i>stream</i>
is not an open file descriptor.

<dt>[EOVERFLOW]<dd>
For
<i>ftell()</i>,
the current file offset cannot be represented correctly in an object
of type 
<b>long</b>.

<dt>[EOVERFLOW]<dd>
For
<i>ftello()</i>,
the current file offset cannot be represented correctly in an object
of type 
<b>off_t</b>.

<dt>[ESPIPE]<dd>
The file descriptor underlying
<i>stream</i>
is associated with a pipe or FIFO.

</dl>
</blockquote><h4><a name = "tag_000_005_343">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_344">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_345">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_346">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="fgetpos.html">fgetpos()</a></i>,
<i><a href="fopen.html">fopen()</a></i>,
<i><a href="fseek.html">fseek()</a></i>,
<i>ftello()</i>,
<i><a href="lseek.html">lseek()</a></i>,
<i><a href="stdio.h.html">&lt;stdio.h&gt;</a></i>,
and the <b>XNS</b> specification description of
<i><a href="../xns/ftell.html">ftell()</a></i>.
</blockquote><h4>DERIVATION</h4><blockquote>
Derived from Issue 1 of the SVID.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>

